package prognosisdataalgo;

import prognosisdataalgo.fuzzy.FuzzyCorrectify;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public class PrognosisDataAlgo {

    private static Coordinate baseCoordinate;
    private static List<Coordinate> positiveCoordinates = new ArrayList<Coordinate>();
    private static List<Coordinate> negativeCoordinates = new ArrayList<Coordinate>();

    static {
        baseCoordinate = new Coordinate(new LatLng(46.964322, 32.007065), "0", 0);

        positiveCoordinates.add(new Coordinate(new LatLng(47.166376, 31.710434), "1", 90));
        positiveCoordinates.add(new Coordinate(new LatLng(46.988684, 32.387466), "3", 50));
        positiveCoordinates.add(new Coordinate(new LatLng(46.878968, 32.217178), "4", 50));
//        positiveCoordinates.add(new Coordinate(new LatLng(47.032695, 29.914856), "7", 40));


        negativeCoordinates.add(new Coordinate(new LatLng(46.883662, 31.926155), "2", 90));
        negativeCoordinates.add(new Coordinate(new LatLng(47.179446, 31.967354), "5", 1));
    }

    public static void main(String[] args) {

//        String days[] = new DateFormatSymbols().getWeekdays();
//        Calendar calendar = Calendar.getInstance();
//        System.out.println(days[calendar.get(Calendar.DAY_OF_WEEK)] + "\n");

        int currentDayIndex = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);

        positiveCoordinates.get(0).addDayFactor(PrognosisFunction.days[currentDayIndex], 60);

        Prognosis prognosis = new Prognosis();
        FuzzyCorrectify correctify = new FuzzyCorrectify(baseCoordinate, positiveCoordinates, negativeCoordinates, false);

        prognosis.setPositiveCoordinates(positiveCoordinates);
        prognosis.setNegativeCoordinates(negativeCoordinates);
        prognosis.setBaseCoordinate(baseCoordinate);

        System.out.println("Positive coordinates:");
        prognosis.showPositiveDistance();
        System.out.println("Negative coordinates:");
        prognosis.showNegativeDistance();

        prognosis.calculateAll();


//        System.out.println("");
        System.out.println("Positive factor values:");
        prognosis.showPositiveFactorValues();
        System.out.println("Negative factor values:");
        prognosis.showNegativeFactorValues();
        System.out.println("");
        System.out.println("Impact values:");
        prognosis.showImpactValue();
        System.out.println("");
        System.out.println("Distance values:");
        prognosis.showDistanceImpactValue();

        System.out.println("");
        System.out.println("Final result:");
        prognosis.showFinalResult();
        System.out.println("");
        System.out.println("Fuzzy rules:");
        prognosis.showFuzzyRules();
        System.out.println("");
        System.out.println("After fuzzy results:");
        prognosis.showAfterFuzzyResults();

        System.out.println("");
        System.out.println("All result values:");
        prognosis.showAllResultValues();

//        String currentDayName = PrognosisFunction.days[Calendar.getInstance().get(Calendar.DAY_OF_WEEK)];
//        System.out.println(currentDayName + ": " + positiveCoordinates.get(0).getDayValue(6));

//        for (int i = 0; i < PrognosisFunction.days.length; i++) {
//            System.out.println(PrognosisFunction.days[i]);
//        }


    }
}
